package com.zyf.chapter01.principle.SOLID.ISP.iteration.last;

import com.zyf.chapter01.principle.SOLID.ISP.ConfigSource;

import java.util.Map;

/**
 * redis配置类
 * @author yifeng
 */
public class RedisConfig implements Updater, Viewer {
    private ConfigSource configSource; //配置中心(此如zookeeper)
    private String address;
    private int timeout;
    private int maxTotal;

    public RedisConfig(ConfigSource configSource) {
        this.configSource = configSource;
    }

    public ConfigSource getConfigSource() {
        return configSource;
    }

    public String getAddress() {
        return address;
    }

    public int getTimeout() {
        return timeout;
    }

    public int getMaxTotal() {
        return maxTotal;
    }

    public void init() {
        //从configSource加载配置到address/timeout/maxTotal...
    }

    @Override
    public void update() {
        // 热更新
    }

    @Override
    public String outputInPlainText() {
        return null;
    }

    @Override
    public Map<String, String> output() {
        return null;
    }
}
